The filter() method is used to create a new array containing all elements that pass a certain condition defined by a provided function.
filter()
It returns a new array with only the elements that satisfy the condition.